package cn.tedu.luban.order.main.consumer;

import cn.tedu.luban.order.main.service.OrderFrontService;
import com.tedu.inn.protocol.exception.BusinessException;
import lombok.extern.slf4j.Slf4j;
import org.apache.rocketmq.spring.annotation.RocketMQMessageListener;
import org.apache.rocketmq.spring.core.RocketMQListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@Slf4j
@Component
@RocketMQMessageListener(topic="order_complete_topic",consumerGroup = "order-group")
public class OrderCompleteConsumer implements RocketMQListener<String> {
    @Autowired
    private OrderFrontService orderFrontService;
    @Override public void onMessage(String orderNo) {
        try{
            orderFrontService.orderComplete(orderNo);
        }catch (BusinessException e){
            e.printStackTrace();
            log.info("订单完成消费失败:{}",e);
        }
    }
}
